<template>
    <div class="container">
        <div class="detail-info">
            <div class="info-container">
                <img src="@/assets/img/project@1x.png" title="project" />

                <div class="info">
                    <span>{{ instance.instanceName }}</span>
                    <span>http://{{ instance.clientIp }}:{{ instance.clientPort }}</span>
                </div>
            </div>

            <nav>
                <ul>
                    <li>
                        <router-link to="info" active-class="active">详情</router-link>
                    </li>
                    <li>
                        <router-link to="level" active-class="active">日志级别</router-link>
                    </li>
                    <li>
                        <router-link to="environment" active-class="active">环境配置</router-link>
                    </li>
                    <li>
                        <router-link to="log" active-class="active">查看日志</router-link>
                    </li>
                    <li>
                        <router-link to="gc" active-class="active">垃圾回收器日志</router-link>
                    </li>
                    <li>
                        <router-link to="jvm" active-class="active">虚拟机</router-link>
                    </li>
                    <li>
                        <router-link to="thread" active-class="active">线程</router-link>
                    </li>
                </ul>
            </nav>
        </div>

        <div class="detail-wrapper">
            <router-view></router-view>
        </div>
    </div>
</template>

<script>
    export default {
        name: 'Instance',
        computed: {
            instance() {
                return this.$store.state.instances.selectedInstance;
            },
        },
    };
</script>

<style lang="scss" scoped>
    .detail-info {
        background: #FFF;
        border-radius: 8px;
        box-shadow: 0 0 10px 0 rgba(226, 232, 237, .5);

        & > .info-container {
            display: flex;
            flex-direction: row;

            & > img {
                margin: 24px 36px 12px 24px;
            }

            & > .info {
                display: flex;
                flex-direction: column;
                margin-top: 27px;
                cursor: default;

                span {
                    font-size: 20px;
                    font-weight: 500;
                    color: rgba(0, 0, 0, .85);

                    &:nth-of-type(2) {
                        font-size: 14px;
                        font-weight: 400;
                        color: #2A6CF0;
                    }
                }
            }
        }

        & > nav {
            margin-left: 24px;

            li {
                float: left;
                margin-right: 30px;
                font-size: 16px;
                font-weight: 400;

                a {
                    display: inline-block;
                    padding: 10px 0;
                    color: rgba(0, 0, 0, .65);
                    border-bottom: 2px solid transparent;

                    &.active, &:hover {
                        color: #2A6CF0;
                        font-weight: 500;
                        border-color: #2A6CF0;
                    }
                }
            }
        }
    }

    .detail-wrapper {
        margin-top: 24px;
    }
</style>
